#include<stdio.h>
#include<unistd.h>

int main()
{
	int a = 0;
	printf("a = %d\n", a);

	printf("Forking......\n");
	pid_t fpid = fork();

	if (fpid < 0)
		printf("Error in fork!\n");
	else if (fpid == 0)
	{
		a++;
		printf("This is child process, pid = %d, a = %d.\n", getpid(), a);
	}
	else
	{
		a++;
		printf("This is parent process, pid = %d, a = %d.\n", getpid(), a);
	}
	return 0;
}